﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using KMFrame.Permission.Util;
using SzCourt.Logic.BLL;
using SzCourt.Logic.NBL.DBEntities;

namespace SzCourt.WebSite.reporter
{
    public partial class detail : System.Web.UI.Page
    {
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!this.IsPostBack)
            {
                getSessionInfo();
                getInfo();
            }
        }

        private void getSessionInfo(){
            if (!SessionBox.CheckUserSession())
            {
                Response.Redirect("/reporter/login.aspx");
            }
            this.spUserName.InnerHtml = SessionBox.GetUserSession().UserName;
            this.spDate.InnerHtml = DateTime.Now.ToString();
        }

        private void getInfo()
        {
            int _id = string.IsNullOrEmpty(Request.QueryString["id"]) ? 0 : Convert.ToInt32(Request.QueryString["id"]);

            ReporterHome bll = new ReporterHome();
            pReporterHomeInfo result = (pReporterHomeInfo)bll.GetInfo(_id);
            if (result!=null)
            {
                this.hTitle.InnerHtml = result.Title;
                this.sdate.InnerHtml = result.AddDateTime.ToString();
                this.divContent.InnerHtml = result.Content;
            }
        }

    }
}